package com.hafu.dao;

import com.hafu.model.RuKuDetail;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class RuKuDetailDao {
    //添加入库明细
    public boolean addRuKuDetail(RuKuDetail rukudetail, Connection conn) throws SQLException
    {
        String sql = "insert into ruku_detail(ruku_id,sp_name,num,price) values(?,?,?,?)";
        PreparedStatement pstmt = conn.prepareStatement(sql);
        pstmt.setInt(1,rukudetail.getRukuid());
        pstmt.setString(2,rukudetail.getSpName());
        pstmt.setBigDecimal(3,rukudetail.getPrice());
        pstmt.setInt(4,rukudetail.getNum());
        int i = pstmt.executeUpdate();
        if (i > 0)
        {
            return true;
        }
        else
        {
            return false;
        }
    }

}
